//
// Created by 11510 on 2024/6/23.
//

#include "OrQuery.h"
#include <memory>
using std::make_shared;


QueryResult OrQuery::eval(const TextQuery &text) const {

    auto right = rhs.eval(text);
    auto left = lhs.eval(text);

//    等价于 new set<>
    auto ret_lines = make_shared<set<line_no>>(left.begin(), left.end());

    ret_lines->insert(right.begin(), right.end());

    return QueryResult(rep(), ret_lines, left.get_file());
}